<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/2/14
 * Time: 14:20
 */

namespace Admin\Model;


use Base\Model\BaseModel;

class ColumnModel extends BaseModel
{
    protected $_validate = array(
        array('title', 'require', '名称必须填写'),
    );
    protected $_auto = array(
        array('status', '1'),
        array('create_time', 'time', self::MODEL_INSERT, 'function'),
        array('last_time', 'time', self::MODEL_BOTH, 'function'),
    );
    protected $_link = array(
      'column'=>array(
          'mapping_type' => self::HAS_MANY,
          'foreign_key' => 'id',
          'parent_key' => 'column_id',
          'mapping_order' => 'sort',
          'condition' => 'status=1',
      ),
        'model'=>array(
            'mapping_type'=>self::BELONGS_TO,
            'foreign_key'=>'model_id',
            'parent_key'=>'id',
            'condition'=>'status=1',
        ),
    );
}